/*
 * Created by Jaren at 2021/11/29 14:18
 */
import 'package:inmotion_protocol/util/byte_util.dart';

class Accessory {
  static const String motor = 'motor';
  static const String battery = 'battery';

  String id = '';
  List<String> sn = [];

  Accessory(this.id, this.sn);

  @override
  String toString() {
    return 'Accessory{id: $id, sn: $sn}';
  }
}

class AccessoryWrapper {
  Map<String, Accessory> accessories = {};

  void put(String id, Accessory accessory) {
    accessories[id] = accessory;
  }

  Accessory? get(String id) {
    return accessories[id];
  }
}

class Device {
  int device = 0;
  String name = '';
  String sn = '';

  Device(this.device, this.sn);

  @override
  String toString() {
    return "device: 0x" + ByteUtil.byte2Hex(device) + ", id: $sn, name: $name";
  }
}

class DeviceWrapper {
  Map<int, Device> devices = {};
}
